#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	static int AM[100][100];
	int n, m;
	int i, j;
	int a, b;

	scanf("%d%d", &n, &m);
	i = j = 0;
	while (i < m) {
		scanf("%d%d", &a, &b);
		a++; b++;

		if (AM[a][b] || AM[b][a]) {
			puts("YES");
			return (0);
		}
		AM[a][b] = AM[b][a] = 1;
		i++;
	}

	puts("NO");
	return (0);
}
